package com.wxx.strategy;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Jetwang
 * @version 1.0
 * @date 2022/5/24 21:53
 */
public class PromotionStrategyFactory {
   private static Map<String, PromotionStrategy> PROMOTION_STRATEGY_MAP = new HashMap<>();
   static {
       PROMOTION_STRATEGY_MAP.put(PromotionKey.LIJIAN, new LiJianPromotionStrategy());
       PROMOTION_STRATEGY_MAP.put(PromotionKey.MANJIAN, new ManJianPromotionStrategy());
       PROMOTION_STRATEGY_MAP.put(PromotionKey.FANXIAN, new FanXianPromotionStrategy());
   }

   PromotionStrategyFactory() {}

   public PromotionStrategy getPromotionStrategy(String promotion) {
       return PROMOTION_STRATEGY_MAP.get(promotion) == null ? new EmptyPromotionStrategy() :  PROMOTION_STRATEGY_MAP.get(promotion);
   }

   private interface PromotionKey {
       String LIJIAN = "LiJian";
       String MANJIAN = "ManJian";
       String FANXIAN = "FanXian";
   }
}
